<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			var timer;
			window.onload=function(){
				showTime();
				timer=window.setInterval(function(){
					document.getElementById("time").innerHTML=new Date().toLocaleString();
					
				},1000);
			}
			var wk=["星期天","星期一","星期2","星期3","星期4","星期5","星期6"];
			function showTime(){
				var day=new Date().getDay();//0-6
				alert(wk[day]);
				
				document.getElementById("time").innerHTML=new Date().toLocaleString();
				
			}
			function stopTime(){
				window.clearInterval(timer);
			}
		</script>
	</head>
	<body>
		<span id="time"></span>
		<input type="button" value="停止计时" onclick="stopTime()" />
	</body>
</html>
